/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.util.Comparator;

/**
 *
 * @author francesco
 */
public class SistemaComparatorVittoriaMinima implements Comparator{

    public int compare(Object o1, Object o2) {

        double min1 = 0.0, min2 = 0.0;
        min1 = ((Sistema)(o1)).getSchedine().get(0).getVittoria() ;
        min2 = ((Sistema)(o2)).getSchedine().get(0).getVittoria() ;


        for (Schedina s : ((Sistema)(o1)).getSchedine()){
            if (min1 > s.getVittoria()){
                min1 = s.getVittoria();
            }
        }
        
        for (Schedina s : ((Sistema)(o2)).getSchedine()){
            if (min2 > s.getVittoria()){
                min2 = s.getVittoria();
            }
        }

        if (min1 == min2){
            return 0;
        }

        if (min1 < min2){
            return 1;
        }

        return -1;



    }

}
